import { List } from 'antd-mobile'
import React from 'react'
import { useDispatch } from 'react-redux'
import { useParams } from 'react-router-dom'
import { addHistory } from '../../../store/slice/ticketSlice'

function SaerchCity(props) {
    const params=useParams()
    const dispatch=useDispatch()
  return (
    <div>
      <List>
        {
            props.list.map((item,i)=>{
                return <List.Item key={i} onClick={()=>{
                    dispatch(addHistory(item.name))
                    props.saveCity(params.type,item.name)
                }}>
                    {item.name}
                </List.Item>
            })
        }
        
        
      </List>
    </div>
  )
}

export default SaerchCity
